﻿@using Apps.Web.Core;
@using Apps.Common;
@using Apps.Models.Sys;
@using Apps.Locale; 
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Index_Layout.cshtml";

    List<permModel> perm = null;
}

<div class="mvctool">
<input id="txtQuery" type="text" class="searchText"/>
@Html.ToolButton("btnQuery", "fa fa-search", Resource.Query,ref perm, "Query", true)
@Html.ToolButton("btnDetails", "fa fa-list", Resource.Details,ref perm, "Details", true)
@Html.ToolButton("btnDelete", "fa fa-trash", Resource.Delete,ref perm, "Delete", true)
</div>

<table id="List"></table>
<div id="Pager"></div>
<div id="modalwindow" class="easyui-window" data-options="modal:true,closed:true,minimizable:false,shadow:false"></div>
@*Jqgrid*@
<script type="text/javascript">
  

    $(function () {
        $('#List').datagrid({
            url: '/SysException/GetList',
            width: SetGridWidthSub(10),
            methord: 'post',
            height: SetGridHeightSub(37),
            fitColumns: true,
            sortName: 'Id',
            sortOrder: 'desc',
            idField: 'Id',
            pageSize: 15,
            pageList: [15, 20, 30, 40, 50],
            pagination: true,
            striped: true, //奇偶行是否区分
            singleSelect: true,//单选模式
            onLoadSuccess:function(data){  
                $(".datagrid-row td div").addClass("exceed");
  
            },
            columns: [[
                { field: 'Id', title: '@Resource.TitleID', width: 40, hidden: true },
                { field: 'HelpLink', title: '帮助链接', width: 40, hidden: true },
                { field: 'Message', title: '异常信息', width: 200},
                { field: 'Source', title: '来源', width: 55 },
                {
                    field: 'StackTrace', title: '堆栈', width: 440, halign: 'center', 
                },
                { field: 'TargetSite', title: '目标页', width: 40, halign: 'center' },
                { field: 'Data', title: '程序集', width: 60, align: 'center' },
                { field: 'CreateTime', title: '发生时间', width: 65, align: 'center' }
            ]]
        });
    });
</script>
@Html.Partial("~/Views/Shared/_Partial_AutoGrid.cshtml")
@*operation*@
<script type="text/javascript">
    //ifram 返回
    function frameReturnByClose() {
        $("#modalwindow").window('close');
    }
    $(function () {
        $("#btnDetails").click(function () {
            var row = $('#List').datagrid('getSelected');
            if (row != null) {

                $("#modalwindow").html("<iframe width='100%' height='100%' frameborder='0' src='/SysException/Details?id=" + row.Id + "&Ieguid=" + GetGuid() + "'></iframe>");
                $("#modalwindow").window({ title: '@Resource.Details', width: 700, height: 400, iconCls: 'fa fa-list' }).window('open');
            } else { $.messageBox5s('@Resource.Tip', '@Resource.PlaseChooseToOperatingRecords'); }
        });
        $("#btnQuery").click(function () {
            var queryStr = $("#txtQuery").val();
            //如果查询条件为空默认查询全部
            if (queryStr == null) {
                queryStr = "%";
            }
            $('#List').datagrid({ url: '/SysException/GetList?queryStr=' + encodeURI(queryStr) });
        });
        $("#btnDelete").click(function () {
            var row = $('#List').datagrid('getSelected');
            if (row != null) {
                $.messager.confirm( '提示', '@Resource.YouWantToDeleteTheSelectedRecords', function (r) {
                    if (r) {
                        $.post("/SysException/Delete?ids=" + row.Id, function (data) {
                            if (data.type == 1)
                                $("#List").datagrid('reload');
                            $.messageBox5s('@Resource.Tip',data.message);
                        }, "json");

                    }
                });
            } else {$.messageBox5s('@Resource.Tip','@Resource.PlaseChooseToOperatingRecords'); }
        });
    });
</script>